package com.example.springbootjackson.requestContext;

import com.example.springbootjackson.traceId.TestTraceInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

@Configuration
public class MvcConfiguration extends WebMvcConfigurerAdapter {

    @Autowired
    private RequestContextInterceptor requestContextInterceptor;
    @Autowired
    private TestTraceInterceptor testTraceInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(requestContextInterceptor)
                .addPathPatterns("/test/**")
                .excludePathPatterns("/warehouse/enable/show/detail/v1");

        registry.addInterceptor(testTraceInterceptor);

    }
}
